package ejb;

import java.util.List;
import javax.ejb.Stateless;
import dao.UsersDao;
import entity.Users;

@Stateless
public class UsersBean implements UsersBeanRemote, UsersBeanLocal {

	@Override
	public void insert(Users user) {
		UsersDao.INSTANCE.save(user);
	}

	@Override
	public void update(Users user) {
		UsersDao.INSTANCE.merge(user);
	}

	@Override
	public void delete(Users user) {
		UsersDao.INSTANCE.delete(user);
	}

	@Override
	public void get(Long id) {
		UsersDao.INSTANCE.findById(id);
	}

	@Override
	public List<Users> getAll() {
		return UsersDao.INSTANCE.findAll();
	}

	@Override
	public Users authenticate(String username, String password) {
		return UsersDao.INSTANCE.authenticate(username, password);
	}

}
